#include <func.h>

typedef struct student
{
    int xuehao;
    char name[20];
    int fenshu;
}stu;

int main(int argc,char*argv[])
{
    int fd;
    fd=open("file",O_RDWR);
    ERROR_CHECK(fd,-1,"open");
    char b[200]={0};
    stu a[3]={1,"zhang",98,2,"zhan",99,3,"zha",100};
    for(int i=0;i<3;i++)
    {
        write(fd,&a[i],sizeof(a));
    }
    lseek(fd,0,SEEK_SET);
    read(fd,b,sizeof(b));
    printf("%s\n",b);
    close(fd);
    return 0;
}